#ifndef __TROPHY_LOGO_INFO_WND_H__
#define __TROPHY_LOGO_INFO_WND_H__

#include "logolib/logo_lib.h"
#include "resource.h"
#include "SimpleWnd/SimpleWnd.h"
#include "SplitterWnd.h"
#include "SimpleWnd/GridCtrl.h"
#include "Edit/EditWindow.h"

#define VARIABLE_VIEWER_CLASS _T("CZFLogoDebugVariableWnd")

class CInfoWindow : 
   public CWnd,
   public IPaneWindow,
   public IDebuggerIF2Editor
{
public:
   CInfoWindow();
   virtual ~CInfoWindow();

   DECLARE_WND_CLASS_EX(VARIABLE_VIEWER_CLASS, 0, COLOR_3DFACE)


   BEGIN_MSG_MAP(CInfoWindow)
      MESSAGE_HANDLER(WM_CREATE, OnCreate)
      MESSAGE_HANDLER(WM_SIZE, OnSize)
      MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
      MESSAGE_HANDLER(GDM_DBL_CLICK, OnGridCellDblClk)
      MESSAGE_HANDLER(GDM_ENTER_PRESSED, OnGridEnterPressed)
      MESSAGE_HANDLER(GDM_END_EDITING, OnGridCellEndEditing)
      COMMAND_ID_HANDLER(CBN_SELCHANGE, OnStackSel)
   END_MSG_MAP()
	
public:
// IPaneWindow interface 
   virtual HWND CreatePaneWindow(HWND hParent, RECT& rc, DWORD dwStyle, DWORD dwExStyle);
   void GetStackInfo(exe_handle_t hexe);

   void ClearAllInfo();
   void Enable(bool bEnable=true);

// IDebuggerIF2Editor
   virtual void GetCurRtnLineNoRange(int* nStart, int* nEnd);
   virtual int GetVaribleValueInCurRtn(LPCTSTR var, TCHAR* buf, size_t size);

protected:
   LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnStackSel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
   LRESULT OnGridCellDblClk(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);   
   LRESULT OnGridCellEndEditing(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);   
   LRESULT OnGridEnterPressed(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);   
   LRESULT EditGrid(LPARAM lParam);

   void LayOut();
   void AddStackItem(LPCTSTR rtn_name, int lineno);
   void ClearGrid();

   HWND    m_hStackList;
   CGridCtrl  m_gdVariables;
   exe_handle_t      m_hexe;

   int   m_nCurRtnStartingLineNo;
   int   m_nCurRtnEndingLineNo;
   int   m_nStackIdx;
};

#endif /* __TROPHY_LOGO_INFO_WND_H__ */